package blackhouse.laobi.io.day19;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

class MyLineNumberReader extends MyBufferedReader2{
    private int lineNumber;
	public MyLineNumberReader(Reader r) {
		super(r);
	}
	public String myReaderLine()throws IOException{
		lineNumber++;
		return super.myReadLine();
	}
	public int getLineNumber() {
		return lineNumber;
	}
	public void setLineNumber(int lineNumber) {
		this.lineNumber = lineNumber;
	}
	
}
public class MyLineNumberReaderDemo {
	public static void main(String[] args) throws IOException {
	  FileReader fr = new FileReader("RuntimeDemo.java");
	  MyLineNumberReader mylnr = new MyLineNumberReader(fr);
	  String line = null;
	  while((line = mylnr.myReaderLine())!=null){
		  System.out.println(mylnr.getLineNumber()+"::"+line);
	  }
	  mylnr.myClose();
	}
}
